﻿<div class="spacing-bottom-sm row" page-header="Manage customer equipment">
    <div class="col-sm-6">
        <input class="form-control" ng-model="customer" typeahead-editable="false" typeahead-on-select="updateState($item)"
               typeahead="customer as customer.name for customer in getCustomerList($viewValue)" placeholder="Customer" autofocus />
    </div>
    <div class="col-sm-6">
        <a class="btn btn-info" ui-sref="customerEquipment-new({customerId: customer.id, customerName: customer.name})" ng-disabled="!customer.id" id="3">
            <b class="glyphicon glyphicon-plus"></b> Add Equipment
        </a>
        <div class="btn btn-info fileinput-button input" disabled>
            <i class="glyphicon glyphicon-upload"></i>
            <span>Import</span>
            <input type="file" ng-file-select="import($file)">
        </div>
        <a class="btn btn-info" href="/Content/templates/equipment-template.csv" download="equipment-template.csv">
            Excel Template
        </a>
    </div>
</div>

<table ng-table="tableParams" class="table table-hover table-bordered ng-table-resizable-columns" ng-visible="$data.length">
    <tr ng-repeat="item in $data">

        <td data-title="'#'" header-class="col-sm-2 width3"><span class="form-control-static">{{item.id}}</span></td>
        <td data-title="'PO#'" header-class="col-sm-1 width3"><span class="form-control-static">{{item.poNumber}}</span></td>
        <td data-title="'Model#'" header-class="col-sm-2 width10"><span class="form-control-static">{{item.modelNumber}}</span></td>
        <td data-title="'Manufacturer'" header-class="col-sm-2 width10"><span class="form-control-static">{{item.manufacturer}}</span></td>
        <td data-title="'Description'" header-class="col-sm-2 width15"><span class="form-control-static">{{item.name}}</span></td>
        <td data-title="'SalesMan'" header-class="col-sm-2 width10"><span class="form-control-static">{{item.salesmanName}}</span></td>
        <td data-title="'Calib Date'" header-class="col-sm-1 width10"><span class="form-control-static">{{item.calibrationDate | date: 'dd/MMM/yyyy'}}</span></td>
        <td data-title="'Due Date'" header-class="col-sm-1 width10"><span class="form-control-static">{{item.nextDueDate | date: 'dd/MMM/yyyy'}}</span></td>
        <td data-title="'Price'" header-class="col-sm-2 width5"><span class="form-control-static">{{item.price | number}}</span></td>

        <td class="text-center" header-class="col-sm-1 width3">
            <a ui-sref="customerEquipment-item({id: item.id})" class="btn btn-default">View</a>
        </td>
    </tr>
</table>
<div ng-show="!tableParams.settings().$loading && tableParams.data.length === 0" class="well text-center">No result</div>
